#include "bits/stdc++.h"
using namespace std;
const int inf = 1e9;

int main() {
  int n, m, c;
  cin >> n >> m >> c;

  vector<int> val(n + 1, 0);
  int cnt = 0, half = ((c + 1) >> 1);
  for (int i = 0, x; i < m; i++) {
    cin >> x;
    int f = -1;
    if (x <= half) {
      f = 1;
      while (f <= n && val[f] && val[f] <= x) {
        f++;
      }
    } else {
      f = n;
      while (f >= 1 && val[f] && val[f] >= x) {
        f--;
      }
    }
    f = max(f, 1);
    f = min(f, n);
    cout << f << '\n';
    cnt += !val[f];
    val[f] = x;
    if (cnt >= n) {
      break;
    }
  }

  return 0;
}